abstract class Shape {
    abstract getArea()
}

class Rectangle extends Shape {
    public width: number
    public height: number

    constructor(width: number, height: number) {
        super()
        this.width = width
        this.height = height
    }

    getArea(): number {
        return this.width * this.height
    }
}

class Circle extends Shape {
    public radius: number

    constructor(radius: number) {
        super()
        this.radius = radius
    }

    getArea(): number {
        return this.radius ** 2 * Math.PI
    }

}

function calcArea(shape: Shape) {
    return shape.getArea()
}

calcArea(new Rectangle(10, 20))
calcArea(new Circle(10))